import { defineStore } from 'pinia'
import { ref } from 'vue';
const InitUserInfo = {
  uid: 0,
  nickname: '张三',
  avatar: '',
}

export const useUserStore = defineStore('user', () => {
    
  const token = ref('laowan');
  const userInfo = ref({ ...InitUserInfo })
  function setToken(val) {
    token.value = val
  }
  return {
    token,
    userInfo,
    setToken,
  }
}, 
{ 
    persist: {
        debug: import.meta.env.DEV,
        pick: ['token'],
    } 
})

export default useUserStore
